home *** CD-ROM | disk | FTP | other *** search
/ Aminet 8 / Aminet 8 (1995)(GTI - Schatztruhe)[!][Oct 1995].iso / Aminet / text / hyper / gmake.lha / gmake / c_source / debug.c next >
C/C++ Source or Header  |  1995-08-22  |  715b  |  51 lines

  1. // Debug stuff
  2. #include "standard.h"
  3.  
  4. FILE * db;
  5. char err_out[] = "KCON:////DEBUG";
  6. static BOOL debug;
  7.  
  8. initialise_debug(BOOL debug_arg)
  9.  {
  10.   debug = debug_arg;
  11.   if(!debug)
  12.     return;
  13.  
  14.   if((db=fopen(err_out,"w")) == NULL) 
  15.     {
  16.     fprintf(stderr,"ERROR Debug option failed."
  17.             " Do you have KCON installed?");
  18.     debug=FALSE;
  19.     return;
  20.     }
  21.  
  22.   REM("Debug On");
  23.  }
  24.  
  25. close_debug()
  26.  {
  27.   if(debug)
  28.     fclose(db);
  29.  }
  30.  
  31. dbug(char * msg, int line,char * file)
  32.  {
  33.   static int i = 1;
  34.   char text[256];
  35.   if(!debug)
  36.         return;
  37.  
  38.   fprintf(db,"DEBUG %3d\t%s\n",i,msg);
  39.   fprintf(db,"\tLine: %d  \tFile: %s\n\n%",line,file);
  40.   fflush(db);i++;
  41.  }
  42.  
  43. dwait()
  44.  {
  45.   if(!debug)
  46.     return;
  47.  
  48.   REM("** pause: press return **");
  49.   getchar();
  50.  }
  51.